package com.sd.one.utils.db.gen;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.sd.one.utils.db.entity.Address;
import com.sd.one.utils.db.entity.Customer;
import com.sd.one.utils.db.entity.Order;
import com.sd.one.utils.db.entity.Product;
import com.sd.one.utils.db.entity.Purchase;

import com.sd.one.utils.db.gen.AddressDao;
import com.sd.one.utils.db.gen.CustomerDao;
import com.sd.one.utils.db.gen.OrderDao;
import com.sd.one.utils.db.gen.ProductDao;
import com.sd.one.utils.db.gen.PurchaseDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig addressDaoConfig;
    private final DaoConfig customerDaoConfig;
    private final DaoConfig orderDaoConfig;
    private final DaoConfig productDaoConfig;
    private final DaoConfig purchaseDaoConfig;

    private final AddressDao addressDao;
    private final CustomerDao customerDao;
    private final OrderDao orderDao;
    private final ProductDao productDao;
    private final PurchaseDao purchaseDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        addressDaoConfig = daoConfigMap.get(AddressDao.class).clone();
        addressDaoConfig.initIdentityScope(type);

        customerDaoConfig = daoConfigMap.get(CustomerDao.class).clone();
        customerDaoConfig.initIdentityScope(type);

        orderDaoConfig = daoConfigMap.get(OrderDao.class).clone();
        orderDaoConfig.initIdentityScope(type);

        productDaoConfig = daoConfigMap.get(ProductDao.class).clone();
        productDaoConfig.initIdentityScope(type);

        purchaseDaoConfig = daoConfigMap.get(PurchaseDao.class).clone();
        purchaseDaoConfig.initIdentityScope(type);

        addressDao = new AddressDao(addressDaoConfig, this);
        customerDao = new CustomerDao(customerDaoConfig, this);
        orderDao = new OrderDao(orderDaoConfig, this);
        productDao = new ProductDao(productDaoConfig, this);
        purchaseDao = new PurchaseDao(purchaseDaoConfig, this);

        registerDao(Address.class, addressDao);
        registerDao(Customer.class, customerDao);
        registerDao(Order.class, orderDao);
        registerDao(Product.class, productDao);
        registerDao(Purchase.class, purchaseDao);
    }
    
    public void clear() {
        addressDaoConfig.getIdentityScope().clear();
        customerDaoConfig.getIdentityScope().clear();
        orderDaoConfig.getIdentityScope().clear();
        productDaoConfig.getIdentityScope().clear();
        purchaseDaoConfig.getIdentityScope().clear();
    }

    public AddressDao getAddressDao() {
        return addressDao;
    }

    public CustomerDao getCustomerDao() {
        return customerDao;
    }

    public OrderDao getOrderDao() {
        return orderDao;
    }

    public ProductDao getProductDao() {
        return productDao;
    }

    public PurchaseDao getPurchaseDao() {
        return purchaseDao;
    }

}
